package com.juyu.miliao.common.domain;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;

/**
 * @author jh
 * 2018/9/30
 */
public class GaodeConfig {

    /**
     * 地理url
     */
    public static final String GEO_URL = "https://restapi.amap.com/v3/geocode/geo";

    /**
     * 逆地理url
     */
    public static final String REGEO_URL = "https://restapi.amap.com/v3/geocode/regeo";

    /**
     * ip转换
     */
    public static final String IP_URL = "https://restapi.amap.com/v3/ip";

    /**
     * web应用key
     */
    private static String key;

    public static String getKey() {
        return key;
    }

    @Value("${gaode.key}")
    public void setKey(String key) {
        if (StringUtils.isEmpty(key)) {
            throw new RuntimeException("config can not be null");
        }
        GaodeConfig.key = key;
    }
}
